<?php namespace App\Http\Requests;

use App\Http\Requests\Request;

class RoleCreateRequest extends Request {

	/**
	 * Determine if the user is authorized to make this request.
	 *
	 * @return bool
	 */
	public function authorize()
	{
		return true;
	}

	/**
	 * Get the validation rules that apply to the request.
	 *
	 * @return array
	 */
	public function rules()
	{
		return [
			'role_name' => 'required|max:10|unique:roles',
			'role_des' => 'required|max:100',
		];
	}

	public function validator()
	{
		$nickName = [
			'role_name' => '角色权限名称',
			'role_des' => '角色权限描述'
		];

		$validator = \Validator::make($this->all(), $this->rules());
		$validator->setAttributeNames($nickName);

		return $validator;
	}
}
